document.querySelector(".message-style").onclick = function (event){
    var ele = event.target;

    console.log(ele.nodeName)
    if (ele.nodeName=="LI"){
       var Lists = ele.parentElement.children;
        for (var i = 0; i <Lists.length ; i++) {
            Lists[i].classList.remove("selected");
        }
        ele.classList.add("selected");
    }else{
        var List1 = ele.parentElement.parentElement.children;
        for ( var a = 0; a <List1.length ; a++) {
            List1[a].classList.remove("selected");
        }
        ele.parentElement.classList.add("selected");
    }
}
document.querySelector(".messages").onclick=function (event){
    var ele = event.target;
    console.log(ele.nodeName);
    if (ele.nodeName=="IMG"){

    }
}


























